Rework interpolate filter, retire some magic numbers. (#498)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Sun, 9 Feb 2020 19:36:54 +0000 (12:36 -0700)
committerGitHub <noreply@github.com>
Sun, 9 Feb 2020 19:36:54 +0000 (12:36 -0700)
commit2e9aa6ca68b30facd3e4f29db78aa25d89a55c7e
tree99dcfc6853b05a0559eab5dad8f551fccc7be06d
parentdffeece0abc7d97a2a6174cb997a12d26269dcd8
Rework interpolate filter, retire some magic numbers. (#498)

* rewrite interpolate filter.

What started out as an investigation of a clang-tidy warning about
a floating point loop counter (FloatLoopCounter, cert-flp30-c)
turned into this.

Use integer loop counters.
Use a variable step size, that is constant for each span, to meet the
constraint of no interval > limit.
Previously steps of the limit size were used leaving the last step in
a span of a different likely shorter size.
Be defensive about user input and track/route input, no more infinite
loops for negative time limits.
Support milliseconds.
Reduce duplication.
Enhance test to more easily verify interpolation steps.
More efficient route list maniupulation.
Correct documentation.
Correct signed literals use with the unsigned argtype.

This does reiterate, but not fix, the deficiency in route_head copying
that recently came up where new members of route_head are not copied.

* correct test to use long long format for TIMET_TIME_MS.

* Eliminate some magic numbers for unit conversion.

Previously the conversion factor for meters to feet was inaccurate.  Correcting
this caused a couple kml test cases to change.

The ozi test was problematic, an altitiude was provided that endend in
0.5 feet, and was printed out rounded to feet.  A one bit error in the
mantissa of the double involved in the round trip to meters could change
the rounding result.  To fix this the ozi writer was changed to print
track altitudes to a tenth of a foot.  This matches an ozi track file found in
the wild as well as our own ozi track sample.

The classic-2 test involving gnuplot.style printed altitude to one millonth
of a foot, i.e. 0.3 micrometers!  The gnu plot style was changed to print
to the thousandth of a foot, i.e. 0.3 millimeters.
23 files changed:
an1.cc
arcdist.cc
defs.h
grtcirc.cc
interpolate.cc
interpolate.h
ozi.cc
radius.cc
reference/bounds-test.kml
reference/dusky.gnuplot
reference/gnuplot.style
reference/track/20070813_short~plt.plt
reference/track/bounds-test-track.kml
reference/track/interptrack.csv [new file with mode: 0644]
reference/track/interptrack.gpx
reference/track/simpletrack.gpx
reference/track/tinterptrack.csv [new file with mode: 0644]
reference/track/tinterptrack.gpx
saroute.cc
testo.d/interpolate.test
trackfilter.cc
vecs.cc
xmldoc/filters/interpolate.xml